<template>
    <div></div>
</template>

<script setup>

// 引入Three.js
import * as THREE from 'three';
 
// 创建场景
const scene = new THREE.Scene();
 
// 创建相机
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
 
// 创建渲染器
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
 
// 创建圆形几何体
// const geometry = new THREE.SphereGeometry(5, 32,16); // 半径为5，分段数为32
 
// // 创建材质
// const material = new THREE.MeshBasicMaterial({ color: 0xffff00 });
 
// // 创建圆形网格对象
// const circle = new THREE.Mesh(geometry, material);
 
// // 将圆形添加到场景
// scene.add(circle);


const geometry = new THREE.SphereGeometry( 5,32,16); 
const material = new THREE.MeshBasicMaterial( { color: 0x00ffff } ); 
const sphere = new THREE.Mesh( geometry, material ); 
scene.add( sphere );
 

// 设置相机位置并指向场景中心
camera.position.z = 10;
// camera.position.set(10,50)
 
// 渲染场景
function animate() {
  requestAnimationFrame(animate);

  sphere.rotation.x += 0.01;
  sphere.rotation.y += 0.01;

  renderer.render(scene, camera);
}
 
animate();


</script>